<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script src="../../plugin/helpers.js"></script>
    <script>
        // curry：  Haskell curry
        // 科里化函数：固定某个函数的一些参数，得到该函数剩余参数的一个新函数，如果没有剩余参数，则调用

        function f(x, y, z) {
            return (x + y) * z;
        }

        // 求：(2+3)*5  (2+5)*6  (2+4)*7  (2+4)*16
        var g = myPlugin.curry(f, 2)
        console.log(g(3, 5));
        console.log(g(5, 6));

        var y = g(4);
        // var y = myPlugin.curry(f, 2, 4)

        console.log(y(7));
        console.log(y(16));
    </script>
</body>

</html>
